# -*- coding:utf-8 -*-
from django.core.exceptions import ObjectDoesNotExist
from django import forms
from django.contrib.auth.models import User
from django.contrib.admin import widgets
from .models import *


class UserForm(forms.Form):

    name = forms.CharField(label='用户姓名', widget=forms.TextInput(attrs={'class': 'form-control',
                                                                       'placeholder': u'用户姓名'}),
                           error_messages={'required': u"用户姓名不能为空。"})
    car_number = forms.CharField(label='车牌号', min_length=7, max_length=9, widget=forms.TextInput(attrs={'class': 'form-control',
                                                                            'placeholder': u'车牌号'}),error_messages={'required': u"车牌号格式错误。"})
    phone = forms.CharField(label='手机',min_length=11, max_length=11, widget=forms.TextInput(attrs={'class': 'form-control',
                                                                      'placeholder': u'手机'}),
                            error_messages={'required': u"手机号格式错误。"})
    vip = forms.BooleanField(label='是否VIP', required=False, error_messages={'required': u"请选择是否VIP"})
    address = forms.CharField(label='地址', required=False, widget=forms.TextInput(attrs={'class': 'form-control',
                                                                                        'placeholder': u'地址'}))
    # expire_at = forms.DateTimeField(required=False, widget=forms.TextInput(attrs={'class': 'form-control',
    #                                                                               'size': 16}))


    class Meta:
        model = UserProfile
        fields = '__all__'
